package com.xzc.common;

/**
 * @auther kaka
 * @Date 2019-11-07
 */
public class ResultBean<T>  {
    public static final int SUCCESS = 200 ;
    public static final int FAIL   = 999 ;


    private String msg = "success";
    private String urlMsg  = "url error";
    private int code = SUCCESS;

    private T data;

    public ResultBean() {
        super();
    }

    public ResultBean(T data) {
        this.data = data;
    }

    public ResultBean(Throwable e) {
        super();
        this.msg = e.toString();
        this.code = FAIL;
    }

    public ResultBean(int code, String msg) {
        this.msg = msg;
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public ResultBean setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public int getCode() {
        return code;
    }

    public ResultBean setCode(int code) {
        this.code = code;
        return this;
    }

    public T getData() {
        return data;
    }

    public ResultBean setData(T data) {
        this.data = data;
        return this;
    }

    public ResultBean setError(String msg) {
        this.code = FAIL;
        this.msg = msg;
        return this;
    }
}
